<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<title>Admin control panel !</title>
</head>

<body>
<?php
session_start();
	if(empty($_SESSION['is_login']) || $_SESSION['is_login']!=1)
	{
		echo ("Ban chua dang nhap");
		die();
	}
?>
<?php include("menu.php");
include("../include/config.php");
$id=$_REQUEST["id"];
$sql="SELECT * FROM users WHERE id=$id";
$rs=mysql_query($sql);
$rw=mysql_fetch_array($rs);


?>

<div id="head-noidung">
	<div id="head-main">
		
		
<form action="" method="GET" name="editusers">
  <table width="621" border="0" align="center">
    <tr>
      <td width="160">Tên đăng nhập:</td>
      <td width="445"><input name="username" id="tenID" type="text" size="35" maxlength="25" value="<?php echo $rw["username"];?>" /><font color="#FF0000"><strong>*</strong></strong></font>      </td>
    </tr>
    <tr>
      <td>Mật khẩu:</td>
      <td><input name="password" type="text" id="passID1" size="50"/>
      <font color="#FF0000"><strong>*</strong></strong></font>      
      </td>
    </tr>

 </table>


  </table>
	  <table width="621" border="0" align="center">

	      <tr>
      <td>Điện thoại:</td>
      <td><input name="tel" type="text" id="dtID" size="35"  maxlength="11" value="<?php echo $rw["tel"];?>"/>
      <font color="#FF0000"><strong>*</strong></strong></font>      </td>
    </tr>
    <tr>
      <td width="161">Họ và tên:</td>
      <td width="450"><input type="text" name="fullname" id="tenlhID" size="35" maxlength="25" value="<?php echo $rw["fullname"];?>"/><font color="#FF0000"><strong>*</strong></strong></font>     </td>
    </tr>
     <tr>
      <td>Địa chỉ Email</td>
      <td><input type="text" name="email" id="mailID" size="35" value="<?php echo $rw["email"];?>"/><font color="#FF0000"><strong>*</strong></strong></font>      </td>
    </tr>
		<tr>
	<td>Hoạt động</td>
	
	<td> 	<select name="status">
				<option value="1" <?php echo ($rw['status'] == 1)?"selected='selected'":""?>> Hiện </option>
				<option value="0" <?php echo ($rw['status'] == 0)?"selected='selected'":""?>> Ẩn </option>
			</select></td> 
	
	</tr>
	

	  
	  
  	<tr><td align="center" colspan="2"><input name="update" type="submit" value="Cập nhật" /> 	    
	<input name="kodangky" type="reset" value="Nhập lại" /></td></tr>
	<input name="id" type="hidden" value="<?php echo $id;?>">
  </table>
  
</form>
</div>	
	
<?php
if(isset($_REQUEST["update"]))
{
	$username=$_REQUEST["username"];
	$password=md5($_REQUEST["password"]);
	$fullname=$_REQUEST["fullname"];
	$email=$_REQUEST["email"];
	$tel=$_REQUEST["tel"];
	$status=$_REQUEST["status"];
	$sql2="UPDATE users	SET username='".$username."'
			,password='".$password."'
			,email='".$email."'
			,fullname='".$fullname."'
			,status=$status
		WHERE id=$id";
		
	mysql_query($sql2);
	header("Location:listmember.php");
	 
}
?>	
	
</div>

<?php include("images/cherry/footer.php"); ?>

</body>
</html>




